import Layout from '@/views/layout/OaLayout'

const layout = function(meta = {}, path = '/oa') {
  return {
    path: path,
    component: Layout,
    meta: {
      requiresAuth: true,
      ...meta
    }
  }
}

export default [
  // 审批
  {
    ...layout({
      title: '审批',
      permissions: ['oa', 'taskExamine']
    }, '/oa/examine'),
    children: [
      {
        path: 'subs/home',
        component: () => import('@/views/oa/taskExamine/superExamine/index'),
        meta: {
          title: '首页',
          icon: 'wk wk-icon-home2'
        }
      }, {
        path: 'subs/application',
        component: () => import('@/views/oa/taskExamine/superExamine/Application'),
        meta: {
          title: '申请',
          icon: 'wk wk-icon-apply-for'
        }
      }, {
        hidden: true, // 不展示 仅用于路由注册
        path: 'subs/statistics/:type',
        component: () => import('@/views/oa/taskExamine/superExamine/examineTableView'),
        meta: {
          redirect: 'subs/upcoming' // 获取传参的重置链接
        }
      }, {
        ignore: true, // 路由添加时忽略
        path: 'subs/statistics/upcoming',
        meta: {
          title: '待办',
          num: 0,
          icon: 'wk wk-icon-backlog'
        }
      }, {
        ignore: true, // 路由添加时忽略
        path: 'subs/statistics/track',
        meta: {
          title: '跟踪',
          icon: 'wk wk-icon-position2'
        }
      }, {
        ignore: true, // 路由添加时忽略
        path: 'subs/statistics/archive',
        meta: {
          title: '归档',
          icon: 'wk wk-icon-archive'
        }
      }, {
        ignore: true, // 路由添加时忽略
        path: 'subs/statistics/draft',
        meta: {
          title: '草稿',
          icon: 'wk wk-icon-draft2'
        }
      }, {
        ignore: true, // 路由添加时忽略
        path: 'subs/statistics/all',
        meta: {
          title: '全部审批',
          icon: 'wk wk-icon-draft2'
        }
      }, {
        path: 'subs/report',
        component: () => import('@/views/oa/taskExamine/superExamine/Report'),
        meta: {
          title: '报表',
          icon: 'wk wk-icon-statement'
        }
      },
      {
        path: 'search',
        meta: {
          title: ''
        },
        component: () => import('@/views/oa/taskExamine/superExamine/Search')
      }]
  },
  // 日志
  {
    ...layout({
      title: '日志',
      permissions: ['oa', 'log']
    }, '/oa/log'),
    children: [{
      hidden: true, // 不展示 仅用于路由注册
      path: 'subs/:type',
      component: () => import('@/views/oa/workLog/index'),
      meta: {
        redirect: 'subs/all' // 获取传参的重置链接
      }
    }, {
      ignore: true, // 路由添加时忽略
      path: 'subs/all',
      meta: {
        title: '全部',
        icon: 'icon-all-line'
      }
    }, {
      ignore: true, // 路由添加时忽略
      path: 'subs/send',
      meta: {
        title: '我发出的',
        icon: 'source-line'
      }
    }, {
      ignore: true, // 路由添加时忽略
      path: 'subs/received',
      meta: {
        title: '我收到的',
        icon: 'receive-line'
      }
    }, { // 个人自定义打印模板
      path: 'log-print-detail',
      name: 'oaLogPrintDetail',
      component: () => import('@/views/admin/oa/logPrintTemplates/PrintTemplateDetail'),
      hidden: true,
      meta: {
        activeMenu: '/manage/oa/print-templates',
        title: '自定义打印模板'
      }
    }]
  },
  // 通讯录
  {
    ...layout({
      permissions: ['oa', 'book']
    }, '/oa/book'),
    children: [{
      path: 'index',
      component: () => import('@/views/oa/addressBook/index'),
      meta: {
        title: '通讯录'
      }
    }]
  },
  // 日历
  {
    ...layout({
      permissions: ['oa', 'calendar']
    }, '/oa/calendar'),
    children: [{
      path: 'index',
      component: () => import('@/views/oa/calendar/index'),
      meta: {
        redirect: 'index', // 获取传参的重置链接
        title: '日历',
        icon: 'board'
      }
    }]
  },
  {
    name: 'logPrint',
    path: '/log/print', // 打印
    hidden: true,
    component: () => import('@/views/oa/workLog/print'),
    meta: {
      requiresAuth: true,
      permissions: ['oa'],
      title: '打印',
      icon: 'print'
    }
  },
  {
    name: 'examinePrint',
    path: '/examine/print', // 打印
    hidden: true,
    component: () => import('@/views/oa/examine/print'),
    meta: {
      requiresAuth: true,
      permissions: ['oa'],
      title: '打印',
      icon: 'print'
    }
  }
]
